﻿/*
 * TLLogicLogin.h
 *
 *  Created on: Feb 10, 2015
 *      Author: yuliang
 */

#ifndef TLLOGICLOGIN_H_
#define TLLOGICLOGIN_H_

#include "LLogicBase.h"

class CTLLogicLogin : public CTLLogicBase {
public:
	CTLLogicLogin();
	virtual ~CTLLogicLogin();

	// 初始化(资源/业务)
	virtual void LogicInit();
	// 捕获此业务模块的业务包,是返回true,否则返回false
	virtual bool CatchLogic(const ProtocolBase *head, char * data, uint32_t len, void * connect);

	void Register(const std::string& account, const std::string& password);
	void Login(const std::string& account, const std::string& password);
	void CreateRole(Type_t type, const std::string& nick);
private:
	void registerResp(const ProtocolBase *head, char * data, uint32_t len);
	void createResp(const ProtocolBase *head, char * data, uint32_t len);
	void loginResp(const ProtocolBase *head, char * data, uint32_t len);
	void loadBaseResp(const ProtocolBase *head, char * data, uint32_t len);
	void loadComplete(const ProtocolBase *head, char * data, uint32_t len);
};

#endif /* TLLOGICLOGIN_H_ */
